<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <meta name="geometry" content="heatmap">
  <link rel="stylesheet" href="./assets/common.css">
  <title>Heatmap</title>
</head>

<body>
<div id="canvas"></div>
<script src="./assets/jquery-3.2.1.min.js"></script>
<script src="../build/g2.js"></script>
<script>
  $.getJSON('./data/heatmap.json', data => {
    const chart = new G2.Chart({
      container: 'canvas',
      forceFit: true,
      height: window.innerHeight,
      padding: 'auto'
      // plotBackground: {
      //   fill: '#666' // 图表背景色
      // }
    });
    chart.coord().reflect('y');
    chart.source(data);
    chart.tooltip({
      showTitle: false
    });
    chart.axis(false);
    chart.legend({
      position: 'right',
      layout: 'vertical'
    });
    chart.heatmap()
      .position('g*l')
      .color('tmp', 'blue-cyan-lime-yellow-red');
    chart.guide().image({
      start: [ 'min', 'max' ],
      end: [ 'max', 'min' ],
      src: 'https://gw.alipayobjects.com/zos/rmsportal/NeUTMwKtPcPxIFNTWZOZ.png'
    });
    chart.render();
  });
</script>
</body>

</html>

